import Request from "@/utils/request.js";

// 文件相关接口
export const UploadFile = (formData) => {
  return Request.post("/ai/file/upload", formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};

export const DeleteAllFiles = () => {
  return Request.post("/ai/file/deleteAll");
};

export const DeleteOneFile = (file) => {
  return Request.post("/ai/file/deleteOne", file);
};

export const ListFiles = (params) => {
  return Request.post("/ai/file/list",params,{
    headers: {
      'Content-Type': 'application/json',
    },
  });
};

// 嵌入向量相关接口
export const AddEmbeddings = (data) => {
  return Request.post("/ai/embeddings/add", data);
};

export const DeleteEmbeddings = (ids) => {
  const param = new URLSearchParams();
  ids.forEach(id => param.append("ids", id));
  return Request.post("/ai/embeddings/delete", param);
};

export const QueryEmbeddings = (queryData) => {
  return Request.post("/ai/embeddings/query", queryData);
};

// 图生成接口
export const GenerateGraph = (data) => {
  return Request.post("/ai/graph/generate", data);
};